//Screen.h - Class Screen

#ifndef _SCREEN_H_
#define _SCREEN_H_

#include "Gotoxy.h"


static enum {SCR_HOR = 80, SCR_VER = 25};	//the edges of the console screen

class Screen
{
private:
	char m_buffer1[SCR_VER][SCR_HOR];	//the first buffer
	char m_buffer2[SCR_VER][SCR_HOR];	//the second buffer
	char (*m_oldBuff)[SCR_HOR];		//pointer to the old buffer
	char (*m_newBuff)[SCR_HOR];	//pointer to the new buffer

	void InitScreen();	//initializet the screen
	void InitBuffer(char (*m_oldBuff)[SCR_HOR]);	//initialize buffer
	bool isLegalPosition(int x, int y) { return (x >= 0 && x < SCR_HOR
		&& y >= 0 && y < SCR_VER) ? true : false ;};
public:
	Screen();
	bool set(int x, int y, char ch);
	void swapPointersAndInitNewBuff();
	void printDiff();
	~Screen() {} ;
};

#endif